package com.example.webdemo.config;

//import com.example.webdemo.interceptor.Rediscountinterceptor;
import com.example.webdemo.interceptor.mtincerceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.rmi.registry.Registry;

/**
 * @Date 2021/6/24 10:12
 * @Created by wangle
 * @Description filter和interceptor区别
 * fliter是servlet的原生组件，好处脱离spring也能用，
 * incerptor是spring自定义的接口，可以使用spring的自动装配功能
 */
//@Configuration
public class adminconfig implements WebMvcConfigurer {
//    @Autowired
//    Rediscountinterceptor rediscountinterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new mtincerceptor() )  //注册拦截器
                .addPathPatterns("/**"). //添加要拦截的路径
                excludePathPatterns("/","/login","/css/**","/js/**","/images/**","/fonts/**");//放行。不需要拦截的路径
//
//        registry.addInterceptor(rediscountinterceptor)
//                .addPathPatterns("/**"). //添加要拦截的路径
//                excludePathPatterns("/","/login","/css/**","/js/**","/images/**","/fonts/**");


    }


}
